package san;
import java.util.*;
public class moives {
	public static void main(String[]args) {
   while(true) {
	   Station station1=new  Station ("窗口1");
	   Station station2=new  Station("窗口2");
	   System.out.println("购票清按1，退票请按2");
	   Scanner reader=new Scanner(System.in);
	  int a=reader.nextInt();
	  switch(a) {
	  case 1:station1.sell();break;
	  case 2:station2.back();return;
	  }
   }
	}
}
  class Station extends Thread{
	  public static int ticket=100;
	  public Station(String name) {
		  super(name);
	  }
	  public void sell() {
		  System.out.println("请输入购买的票数：");
		  Scanner reader=new Scanner(System.in);
		  int a=reader.nextInt();
		  System.out.println("购买"+a+"张票.成功");
		  ticket=ticket-a;
		  System.out.println("还有多少票"+ticket+"张");
		  
	  }
	  public void back() {
		  System.out.println("输入需要退票的数目：");
		  Scanner reader=new Scanner (System.in);
		  int a=reader.nextInt();
		  System.out.println("退票成功。");
		  ticket=ticket+a;
		  System.out.println("还有多少票"+ticket+"张");
	  }
  }
